package com.example.utils;

import com.example.DTO.UserDTO;

/**
 * 线程隔离实现类
 */
public class UserHolder {
    public static final ThreadLocal<UserDTO> TL = new ThreadLocal<>();

    public static void saveUser(UserDTO userDTO) {
        TL.set(userDTO);
    }

    public static UserDTO getUser() {
        return TL.get();
    }

    public static void removeUser() {
        TL.remove();
    }
}
